import chardet
f = open('file','r')
fencoding=chardet.detect(f.read())
print fencoding
